package com.nut.spp.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.nut.spp.common.BaseEntity;
import lombok.Data;

import java.util.List;

/**
 * 类目表
 */
@Data
@TableName("biz_category")
public class Category extends BaseEntity {

    private Integer id;

    //父类目ID
    private Integer pid;

    //类目名称
    private String name;

    //图片
    private String img;

    //排序 按从小到大排序，数字越小越前面
    private Integer sort;

    //层级 1一级 2二级 3三级
    private Integer level;

    //佣金比例 千分之几
    private Integer bonusRatio;

    //是否开启保护 1开启 0关闭
    private Integer protect;

    //性质 1实物 2服务
    private Integer nature;

    //状态 1开启 0关闭
    private Integer status;

    @TableField(exist = false)
    private List<Category> sub;

    public void filled(Category cat) {
        this.id = cat.getId();
        this.pid = cat.getPid();
        this.name = cat.getName();
        this.img = cat.getImg();
        this.sort = cat.getSort();
    }

}
